package druid;

import com.alibaba.druid.pool.DruidDataSourceFactory;
import org.junit.Test;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;

import javax.sql.DataSource;
import java.io.InputStream;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.Properties;

public class DruidDemo {
    public static void main(String[] args) throws Exception {
        Connection conn1 = DruitUtill.getConnection();
        Connection conn2 = DruitUtill.getConnection();
        String sql = "select * from emp";
        PreparedStatement preparedStatement = conn1.prepareStatement(sql);
        ResultSet resultSet = preparedStatement.executeQuery();
        resultSet.next();
        System.out.println(resultSet.getInt("sal"));
        System.out.println("conn = " + conn1);
        conn2.close();
        System.out.println("conn = " + conn2);
    }
}